const app = getApp();
const Config = require('./config.js');
const creq = require('../util/cloud-requtil.js');
const ereq = require('../util/requtil.js');
const SevMode = Config.SevMode;
async function GetOpenData(){
  if(SevMode == 'Cloud'){
    return await creq.GetOpenData();
  }else{
    return await ereq.GetOpenData();
  }
}
async function UploadImage(path){
  if(SevMode == 'Cloud'){
    return await creq.UploadImage(path);
  }else{
    return await ereq.UploadImage(path);
  }
}
async function UpCircleInfo(_res){
  //console.log(_res)
  if(SevMode == 'Cloud'){
    return await creq.UpCircleInfo(_res);
  }else{
    return await ereq.UpCircleInfo(_res);
  }
}
async function QueryCircleInfo(skipstep){
  if(SevMode == 'Cloud'){
    return await creq.QueryCircleInfo(skipstep);
  }else{
    return await ereq.QueryCircleInfo(skipstep);
  }
}
async function GetOneCircleInfo(cid){
  if(SevMode == 'Cloud'){
    return await creq.GetOneCircleInfo(cid);
  }else{
    return await ereq.GetOneCircleInfo(cid);
  }
}
async function UpCommentInfo(cid,commentText,replyid,replynickname){
  let Safe = Config.ContentSafe;
  if(SevMode == 'Cloud'){
    return creq.UpCommentInfo(cid,commentText,Safe);
  }
  else
  {
    return ereq.UpCommentInfo(cid,commentText,replyid,replynickname);
  }
}
async function GetCommentInfo(cid){
  if(SevMode == 'Cloud'){
    return await creq.GetCommentInfo(cid);
  }else{
    return await ereq.GetCommentInfo(cid);
  }
}
async function UpThumbInfo(cid){
  if(SevMode == 'Cloud'){
    return await creq.UpThumbInfo(cid);
  }else{
    return await ereq.UpThumbInfo(cid);
  }
}
async function GetThumbInfo(cid){
  if(SevMode == 'Cloud'){
    return await creq.GetThumbInfo(cid);
  }else{
    return await ereq.GetThumbInfo(cid);
  }
}
async function AuthUserPri(){
  if(SevMode == 'Cloud'){

  }else{
    return await ereq.AuthUserPri();
  }
}
async function UpAuthReq(userinfo){
  if(SevMode == 'Cloud'){

  }else{
    return await ereq.UpAuthReq(userinfo)
  }
}
async function GetAuthUserStatus(status){
  if(SevMode=='Cloud'){

  }else{
    return await ereq.GetAuthUserStatus(status);
  }
}
async function EditAuthStatus(id,status){
  if(SevMode == 'Cloud'){

  }else{
    return await ereq.EditAuthStatus(id,status);
  }
}
async function DelCircleInfo(id){
  if(SevMode=='Cloud'){
    return await creq.DelCircleInfo(id);
  }else{
    return await ereq.DelCircleInfo(id);
  }
}
module.exports={
  GetOpenData,
  UploadImage,
  UpCircleInfo,
  QueryCircleInfo,
  GetOneCircleInfo,
  UpCommentInfo,
  GetCommentInfo,
  UpThumbInfo,
  GetThumbInfo,
  AuthUserPri,
  UpAuthReq,
  GetAuthUserStatus,
  EditAuthStatus,
  DelCircleInfo
}